<template>
  <div>
    <router-view></router-view>

    <div class="nav" v-show="$store.state.flag">
      <router-link to="/">
        <span class="iconfont icon-dianying1"></span>
        <br />
        列表</router-link
      >
      <router-link to="/shoppingcar">
        <span class="iconfont icon-yingyuan"></span>
        <br />
        购物车</router-link
      >
      <router-link to="/mine">
        <span class="iconfont icon-shouye"></span>
        <br />
        我的</router-link
      >
    </div>
  </div>
</template>
<script>
import { mapActions } from "vuex";
export default {
  methods: {
    ...mapActions("myaddressStore", {
      initAddressList: "initList",
    }),
    ...mapActions("shoppingStore", {
      initShoppingcarList: "initList",
    }),
  },
  created() {
    let userinfo = window.localStorage.getItem("userinfo");
    if (userinfo) {
      userinfo = JSON.parse(userinfo);
      this.initAddressList({
        userid: userinfo.id,
      });
      this.initShoppingcarList({
        userid: userinfo.id,
      });
    }
  },
};
</script>

<style lang="scss">
.nav {
  position: fixed;
  left: 0;
  bottom: 0;
  display: flex;
  width: 100%;
  background-color: white;
  line-height: 25px;
  a {
    flex: 1;
    text-align: center;
  }
}
a.router-link-active {
  color: #ff5f16;
}
</style>
